enum element count C#

48

enum element count C# -

var myEnumMemberCount = Enum.GetNames(typeof(MyEnum)).Length;

enum element count C# -

var count1 = typeof(TestEnum).GetFields().Length;
var count2 = Enum.GetNames(typeof(TestEnum)).Length;
var count3 = Enum.GetValues(typeof(TestEnum)).Length;

Comments

Submit
0 Comments